package com.xtoad.demo.rpc.provider.service.impl;

import com.xtoad.demo.rpc.api.entity.User;
import com.xtoad.demo.rpc.api.service.UserService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

/**
 * 用户服务实现类
 *
 * @author xtoad
 * @date 2021-10-14
 */
@Component
@DubboService(version = "${xtoad.rpc.service.version}", protocol = {"rest", "dubbo"})
public class UserServiceImpl implements UserService {
    /**
     * 根据ID获取用户信息
     *
     * @param id 用户ID
     * @return 用户信息
     */
    @Override
    public User getUserById(Integer id) {
        User user = new User();
        user.setId(id);
        user.setName("xtoad");
        user.setAge(24);

        return user;
    }
}
